﻿Imports omen02
Public Class InsertarPaquete




    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Me.Close()
        Me.Visible = False
    End Sub


    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Ingresar los datos a la base de datos


        Dim x = Me.dcnregistrarpaquete.Text

        Dim y = Me.pagoregistrarpaquete.Text

        Dim z = Me.productospagoregistrarpaquete.Text


        Dim n = New PaqueteNegocio()



        Dim paquete = n.insertar(x, y, z)

        MsgBox("Paquete registrado!!!!")

        'Limpiar cajitas de texto desues de ingresar datos
        dcnregistrarpaquete.Clear()
        pagoregistrarpaquete.Clear()
        productospagoregistrarpaquete.Clear()

    End Sub

   
    Private Sub pagoregistrarpaquete_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles pagoregistrarpaquete.MaskInputRejected

    End Sub

    Private Sub InsertarPaquete_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub dcnregistrarpaquete_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dcnregistrarpaquete.TextChanged
       
    End Sub

    Private Sub productospagoregistrarpaquete_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles productospagoregistrarpaquete.TextChanged

    End Sub

    Private Sub Buscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscar.Click

        'solo Listar paquetes

        Dim negocio As New PaqueteNegocio
        Dim paquetes As Collection = negocio.listar()
        Me.dgvpaquete.DataSource = paquetes
        Me.dgvpaquete.EditMode = False

        Me.dgvpaquete.Columns(0).HeaderText = "idPaquete"
        Me.dgvpaquete.Columns(1).HeaderText = "descripcion"
        Me.dgvpaquete.Columns(2).HeaderText = "pago"
        Me.dgvpaquete.Columns(3).HeaderText = "productos"
       


    End Sub

    Private Sub LogoPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoPictureBox.Click

    End Sub

    Private Sub dgvpaquete_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvpaquete.CellContentClick

    End Sub

   
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim seleccionado = Me.dgvpaquete.CurrentRow.Cells(0).Value.ToString
        Dim seleccionado1 = Me.dgvpaquete.CurrentRow.Cells(1).Value.ToString
        Dim seleccionado2 = Me.dgvpaquete.CurrentRow.Cells(2).Value.ToString
        Dim seleccionado3 = Me.dgvpaquete.CurrentRow.Cells(3).Value.ToString
        Dim form As New ActualizarPaquete
        form.MdiParent = Me.MdiParent
        form.lblId.Text = seleccionado
        form.dcnregistrarpaquete.Text = seleccionado1
        form.pagoregistrarpaquete.Text = seleccionado2
        form.productospagoregistrarpaquete.Text = seleccionado3

        form.Show()
    End Sub
End Class